﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LTHD_Web
{
    public partial class Loadtopic : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            dbDataContext db = new dbDataContext();
            int placeid = int.Parse(Request["cid"]);


            var query = from com in db.comments
                        join acc in db.taikhoans on com.taikhoan equals acc.id
                        where com.diadiem == placeid && com.commentid == null
                        orderby com.id descending
                        select new
                        {
                            id = com.id,
                            username = acc.tentaikhoan,
                            message = com.noidung,
                            commenttime = com.date,
                        };
            lb_content.Text = "";
            foreach (var n in query)
            {
                lb_content.Text += "<div class='fbmaincontent' > <div class='fbstorycontent' ><div class='fbprofileimg' ><a href='#'>    <img src='images/profile1.jpg' width='60px'  /></a>  </div><div class='fbprofilename' > <a href='#'>" + n.username + "</a></div><div class='messageinner' >" + n.message + "</div><div class='messageinner' id='maincomment" + n.id + "'  style='color:Gray; '> <a href='#'> Like</a>&nbsp;  <a href='#' onclick='showcomment(" + n.id + ")'> Show comment</a> &nbsp; <a href='#'> Share</a> &nbsp;&nbsp; " + n.commenttime + " </div><div class='messageinner' id='subcomment" + n.id + "'> </div></div></div><div style='clear:both'></div>    ";
            }

            
        }
    }
}